﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.ServiceModel.Web;

namespace Person
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IJsonService" in both code and config file together.
    [ServiceContract]
    public interface IJsonService
    {
        [OperationContract]
        //[WebGet(UriTemplate = "getPeople")]
        [WebInvoke(Method="GET", BodyStyle= WebMessageBodyStyle.Bare,
            ResponseFormat=WebMessageFormat.Json, UriTemplate="getPeople")]
        Person[] getPeople();

        [OperationContract]
        [WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare,
            ResponseFormat = WebMessageFormat.Json, UriTemplate = "savePeople?name={name}")]
        Person[] savePeople(string name);

    }
    [DataContract(Name="Person")]
    public class Person
    {
        [DataMember(Name="id")]
        public int id {get;set;}
        [DataMember(Name="name")]
        public string name { get; set; }
    }
}
